{__NOLAYOUT__}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>酷学网</title>
<import type='css' file="Css.bdsstyle" />
<import type='js' file="Js.hm" />
<import type='js' file="Js.analytics" />
<import type='js' file="Js.logger" />

<import type='css' file="Css.common_s2" />
<import type='css' file="Css.libs" />
<import type='css' file="Css.jquery-ui-1" />
<import type='css' file="Css.select2" />

<import type='js' file="Js.json2" />
<import type='js' file="Js.jquery-1" />
<import type='js' file="Js.jquery-ui-1" />
<import type='js' file="Js.jquery-ui-timepicker-addon" />
<import type='js' file="Js.select2-min" />
<import type='js' file="Js.public_v2" />
<import type='js' file="Js.jquery-1-8-2-min" />
<js href="__PUBLIC__/Js/layer-v2.1/layer/layer.js" />
<import type='js' file="Js.jquery-1-3-2-min" />

<js href="__PUBLIC__/ueditor/ueditor.config.js" />
<js href="__PUBLIC__/ueditor/ueditor.all.min.js" />
<script>
    $(function(){
        var ue = UE.getEditor('container',{
            serverUrl :'{:U('Index/Course/ueditor')}'});
    })
</script>



</head>
<body>

<div id="adcode1044"></div>
<div id="adcode869"></div>
<!-- <div id="downmsg_emessage" class="downmsg_emessage" style="display: none;right:58px;">
    <div id="downmsgBar" class="white">酷学推荐
        <div id="donwmsg_head"></div>
        <a href="javascript://;" class="close" target="_self"></a>
    </div><div id="donwmsg_content">
   
    <div class="fc">
        <a class="fl" target="_blank" href="http://www.koo.cn/zhuanti/cetsf/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">
            <img src="__ROOT__/Public/Images/2016-2-26-1456454488193.jpg" style="margin: 10px 10px 6px 2px;vertical-align: middle;" height="75" width="275">
        </a>
    </div>
        <ul class="fc list-paddingleft-2" style="margin-bottom:20px">
            <li>
                [<a style="color:#FF0000" target="_blank" href="http://www.koo.cn/zhuanti/ss/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">四六级</a>]
                <a target="_blank" href="http://www.koo.cn/zhuanti/ss/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">周思成一笑而过系列之四六级全程通关班</a>
            </li>
            <li>
                [<a style="color:#FF0000" target="_blank" href="http://www.koo.cn/findClass/2-0-1?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">考研</a>]
                <a target="_blank" href="http://www.koo.cn/zhuanti/shiwenwk/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">2017考研英语能力提升班</a>
                <a target="_blank" href="http://www.koo.cn/findClass/2-71-1/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">16考研复试</a>
            </li>
            <li>
                [<a style="color:#FF0000" target="_blank" href="http://www.koo.cn/findClass/6-66-1/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">英美文学</a>]
                <a target="_blank" href="http://www.koo.cn/zhuanti/xixue/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">走进西方文学 品味历史人文第三季</a>
            </li>
            <li>
                [<a style="color:#FF0000" target="_blank" href="http://www.koo.cn/zhuanti/qzz/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">王牌语音课</a>]
                <a target="_blank" href="http://www.koo.cn/zhuanti/qzz/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">摆脱中国式口音：邱邱语音大讲堂</a>
            </li>
            <li>
                [<a style="color:#FF0000" target="_blank" href="http://www.koo.cn/zhuanti/gaokao/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">16高考</a>]
                <a target="_blank" href="http://www.koo.cn/zhuanti/2016gaokao/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">高考百天冲刺</a>
                <a target="_blank" href="http://www.koo.cn/zhuanti/hui/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">李辉英语王牌课程</a>
            </li>
            <li>
                [<a style="color:#FF0000" target="_blank" href="http://www.koo.cn/findClass/8-0-1/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">9.9元</a>]
                <a target="_blank" href="http://www.koo.cn/findClass/8-61-1/?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">PS平面设计从小白到大神</a>
                <a target="_blank" href="http://www.koo.cn/course/4312?hmsr=koo&amp;hmmd=tips&amp;hmpl=&amp;hmkw=&amp;hmci=">职场精英炼成记</a>
            </li>
        </ul>
   
    </div>
</div> -->
<script>
    function loadform(){}
</script>
<script type="text/javascript">
    $(function(){
        $("#head_close").click(function(){
            $.ajax({
                url: "/shopping/removeSession",
                type: 'get',
                dataType:'text',
                success: function(){}
            });
        });

    });
</script>

<div id="header" class="koo_header">
    <div class="w980 matuo fc">
        <div class="logo fl w220 mt8"><a href="{:U('Index/Index/index')}"><img src="__ROOT__/Public/Images/logo_v2.png" alt="logo" height="49" width="187"></a></div>
        <div class="menus ft16 fl">
            <ul>
                <li><a href="{:U('Index/Index/index')}" class="  pl0">首页</a></li>
                <li><a href="http://www.koo.cn/findClass/0-0-1/">发现课程</a></li>
                <li><a href="http://www.koo.cn/teacher/0-0-0-0/">发现老师</a></li>
                <li><a href="http://www.koo.cn/userProduct/myProduct/1/horizontal" rel="nofollow">我要听课</a></li>
                <li><a href="{:U('Index/Course/index')}" class=" ">我要教课</a></li>
                <li><a href="http://bbs.koo.cn/" target="_blank">酷学社区</a></li>
            </ul>
        </div>
        <div class="user-tool fl">
            <!--登录前-->
            <if condition="$Think.session.uid eq ''">
            <ul class="">
                <li>
                    <a class="blue" href="javascript:void(0);" onclick="javascript:$('#userName').focus();return false;">
                        登录
                    </a>
                </li>
                <li class="spacer"></li>
                <li><a href="http://www.koo.cn/head/toRegist?next_page=http%3A%2F%2Fwww.koo.cn%2Fhead%2FtoLogin">注册</a></li>
            </ul>
            <!-- 登录前 E -->
            <!-- 登录后 S-->
            <else/>
            <dl class="fc">
                <dd class="shopcar">
                    <div class="car-icon has-menu" id="shop_car_top">
                        <span class="icons icons-car-black ft12"></span>
                        <i id="lhb_cart_num" style="position: relative;left: 40px;top: -15px;" >(1)</i>
                    </div>
                    <div class="car-content bg_white" id="buy_list">
                        <p style="display: none;" id="lhb_cart_lt1_h" class="ft12 center pt20 pb20 hide">购物车中还没有课程，赶紧<a href="http://www.koo.cn/findClass/0-0-1/" class="ml5 mr5">选购</a>吧！</p>
                        <div class="car-class ft12" id="lhb_cart_lt1"><ul><li class="fc"><a class="buy_car_img fl" href="http://www.koo.cn/course/5085"><img src="__ROOT__/Public/Images/1449730046486340.jpg" onerror="this.src='http://images.koolearn.com/www/subject/kuxue/img/common/default_im.jpg'" height="35" width="56"></a><h3 class="buy_car_title fl"><a href="http://www.koo.cn/course/5085" title="智鸣哥教你学英语之17考研长难句精讲班(寒假特训)">智鸣哥教你学英语之17考研长难句精讲班(寒假特训)</a></h3><div class="buy_car_pri fr"><span class="yellow fwb">￥399</span><br><a href="javascript:void(0);" onclick="theCartDel(67524588,5085,0)">×</a></div></li></ul><div class="count fc"><div class="text fl">共计1门课程<br>合计:<span class="yellow fwb">399</span>元</div><a class="btn btn_yellow3 fr ft14 mr5" href="http://www.koo.cn/shopping/gotoCart">去购物车结算</a></div></div>
                    </div>
                </dd>
                <dd>
                    <div class="message ">
                        <a href="http://www.koo.cn/customer/toMessage/1"><span class="icons icons-message ft12 mt5"><i id="lhb_msg_num" style="display:none;">(<strong></strong>)</i></span></a>
                    </div>
                </dd>
                <dd class="tools">
                    <div class="has-menu center">
                        <a href="http://www.koo.cn/liveStatistic/getLive">
                        </a><a href="http://www.koo.cn/liveStatistic/getLive"><img class="mt18 img-circular" src="__ROOT__{$userInfo['face']}" height="34" width="34"></a>


                    </div>
                    <div class="menu-content ft12">
                        <div class="item"><a href="http://www.koo.cn/liveStatistic/getLive" title="jiajiakatong" class="over-elips">{$userInfo['username']}</a></div>
                        <div class="item"><a href="http://www.koo.cn/userProduct/myProduct/1/horizontal"><em class="icons icons-lister"></em>我要听课</a></div>
                        <div class="item"><a href="{:U('Index/Course/index')}"><em class="icons icons-compute"></em>我要教课</a></div>
                        <div class="item"><a href="{:U('Index/Customer/index')}"><em class="icons icons-setting"></em>个人设置</a></div>
                        <div class="item"><a href="{:U('Index/Customer/password')}"><em class="icons icons-key"></em>密码修改</a></div>
                        <div class="item"><a id="head_close" href="{:U('Index/Login/logout')}" target="_self"><em class="icons icons-login-out"></em>退出</a></div>
                    </div>
                </dd>
            </dl>
            </if>
        </div>
        <!-- 登录后 E -->
    </div>
</div>
<!-- form login start -->
<!-- <form id="_loginForm" action="http://login.koo.cn/sso//login.do" method="post" style="display:none">
    <input name="_userName" id="_userName" type="hidden">
    <input name="_password" id="_password" type="hidden">
    <input name="_autoLogin" id="_autoLogin" value="on" type="hidden">
    <input name="_next_page" id="_next_page" type="hidden">
    <input name="_failPage" id="_failPage" value="http://www.koo.cn" type="hidden">
</form> -->
<!-- form login end -->
<!-- 用户登录框 -->

<div sj="mouseover" class="jhl_pop_box  jhl_pop  v3" id="pop_login_v2" style="display:none;">
    <div class="pop_tab">
        <ul>
            <li class="cur"><span>酷学网账号登录</span></li>
            <li><span>新东方网账号登录</span></li>
        </ul>
    </div>
    <div class="pop_ct">
        <!-- 酷学网账号登录  -->
        <form style="display: block;" action="" method="post">
            <dl class="login_box ft14 v3 pt10">
                <dt class="text gray99 "> 用新东方在线www.koolearn.com帐号可以直接登录</dt>
                <div class="warning hide" id="pnameError">
                    <em class="lhb_reg_ico2"></em>
                    <span class="red ft12" id="pnameErrorText"></span>
                </div>
                <dd class="sel ft14">
                    <!--<div class="inputs focus">-->
                    <div class="inputs">
                        <label for="userName" class="pos_r">
                            <em class="ioc-input-user"></em>
                            <em class="ioc-input-close" onclick="$('#puserName').val('');"></em>
                            <input class="input-username" maxlength="50" id="puserName" name="puserName" placeholder="请输入手机号或邮箱或用户名" onfocus="$(this).parents('.inputs').addClass('focus')" onblur="$(this).parents('.inputs').removeClass('focus');valid()" type="text">
                        </label>
                    </div>
                    <div class="infos hide" id="nameError">
                        <em class="lhb_reg_ico2"></em>
                        <span class="red" id="nameErrorText"></span>
                    </div>
                    <div class="infos hide" id="returnError">
                        <em class="lhb_reg_ico2"></em>
                        <span class="red">用户名或密码错误</span>
                    </div>
                </dd>
                <dd>
                    <!--<div class="inputs focus">-->
                    <div class="inputs ">
                        <label for="pwd" class="pos_r">
                            <em class="ioc-input-pwd"></em>
                            <em class="ioc-input-close" onclick="$('#ppassword').val('');"></em>
                            <input class="input-username" maxlength="16" id="ppassword" name="ppassword" placeholder="请输入密码" onfocus="$(this).parents('.inputs').addClass('focus')" onblur="$(this).parents('.inputs').removeClass('focus');valid()" type="password">
                        </label>
                    </div>
                    <div class="infos hide" id="ppwdError">
                        <em class="lhb_reg_ico2"></em>
                        <span class="red" id="ppwdErrorText"></span>
                    </div>
                </dd>
                <dt class="fc autologin">
                    <label><input id="pro" name="autoLogin" value="on" type="checkbox">
                        <span class="ml5 gray2" onclick="">自动登录</span>
                    </label>
                </dt>
                <dt class="mt10">
                    <a class="login-btn" href="#" submit="true" onclick="login()">登录 </a>
                </dt>
                <dt class="freetoreg w300 fc">
                    <a href="http://www.koo.cn/head/toRegist?next_page=http%3A%2F%2Fwww.koo.cn%2Fcustomer%2FtoUserInfo" class="fl">免费注册</a>
                    <a href="http://www.koo.cn/head/getBackPwd" class="blue fr">忘记密码?</a>
                </dt>
            </dl>
        </form>
        <form action="" method="post" style="display: none;" id="xdfForm">

        </form>

        <div class="third_login ft14">
            <div class="gray2 tal">其他合作平台账户登录：</div>
            <a href="javascript:void(0);" class="aoth_wx_v3" onclick="thirdLogin('weixin','add');" target="_self"></a>
            <a href="javascript:void(0);" class="aoth_qq_v3" onclick="thirdLogin('qq','add');" target="_self"></a>
            <a href="javascript:void(0);" class="aoth_weibo_v3" onclick="thirdLogin('sinaweibo','add');" target="_self"></a>
            <a href="javascript:void(0);" class="aoth_baidu_v3" onclick="thirdLogin('baidu','add');" target="_self"></a>
        </div>
    </div>
</div>





<script>
    function wxlogin(){
    //评论
        var d_url=document.location.href;
        var num = d_url.indexOf("/head/toLogin");
        if(num>0){
            d_url=d_url.replace("/head/toLogin","/findClass/0-0-1/");
        }
        var openUrl = "";//弹出窗口的url
        var iWidth=800; //弹出窗口的宽度;
        var iHeight=650; //弹出窗口的高度;
        var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
        var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
        window.open("http://login.koo.cn/sso/weixinProxyLogin.do?sceneId=1&next_page="+d_url,"aa","height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft,'toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no');
    }
    // $(function(){
    //     var loginStr="1";
    //     if(loginStr=="1"){
    //         //用户信息定时显示
    //         var msgNum=0;
    //         var msgTime=setInterval(function(){
    //             $.ajax({
    //                 type: "GET",
    //                 url: "/head/getMsg",
    //                 cache:false,
    //                 success: function(data){
    //                     if(data == 'error.user.kicked'){
    //                         window.location='http://www.koo.cn/head/toLogin?errCode=error.login.kicked';
    //                     }
    //                     else if(isNaN(parseInt(data)) || parseInt(data)==0){
    //                         $("#lhb_msg_num").hide();
    //                     }else{
    //                         msgNum=parseInt($("#lhb_msg_num strong").text());
    //                         $("#lhb_msg_num").show();
    //                         $("#lhb_msg_num strong").text(data);
    //                         $("#tool_popmsg").text(data);
    //                         if(msgNum<parseInt(data)){
    //                             $("#tool_msg").show();
    //                         }
    //                     }
    //                 }
    //             });
    //         },60000);

    //         //购物车数量
    //         theCartNum();
    //         //购物车详情列表
    //         theCartDetail();
    //     }
    // })


    function theCartNum(){
    //购物车数量
        $.ajax({
            type: "GET",
            url: "/shopping/cartCourseCount",
            cache:false,
            dataType: "json",
            success: function(data){
                if(isNaN(parseInt(data.result)) || parseInt(data.result)==0){
                    $("#lhb_cart_num").hide();
                }else{
                    $("#lhb_cart_num").show();
                    //$("#lhb_cart_num strong").text(data.result);
                    $("#lhb_cart_num").text("("+data.result+")");
                }
            }
        });
    }
    function theCartDetail(){
    //购物车详情列表
        $.ajax({
            type: "GET",
            url: "/shopping/cartCourseDetail",
            cache:false,
            dataType: "json",
            success: function(data){
                if(data.result.totalCount<=0){
                    $("#lhb_cart_lt1_h").show();
                }else{
                    $('#lhb_cart_lt1').empty();
                    var html = '';
                    $("#lhb_cart_lt1_h").hide();
                    html ="<ul>"
                    for (var i=0;i<data.list.length;i++){
                        html +='<li class="fc">'+
                                '<a class="buy_car_img fl" href="/course/'+ data.list[i].productId +'">'+
                                '<img src="'+ data.list[i].productIconUrlStr +'" onerror=\"this.src=\'http://images.koolearn.com/www/subject/kuxue/img/common/default_im.jpg\'\" width="56" height="35">'+
                                '</a>'+
                                '<h3 class="buy_car_title fl"><a href="/course/'+ data.list[i].productId +'" title="'+ data.list[i].productName +'">'+ data.list[i].productName +'</a></h3>'+
                                '<div class="buy_car_pri fr">'+
                                '<span class="yellow fwb">￥'+ data.list[i].productDiscountPrice +'</span><br>'+
                                '<a href="javascript:void(0);" onclick="theCartDel('+data.list[i].userId+','+data.list[i].productId+','+data.list[i].promotionId+')">×</a>'+
                                '</div>'+
                                '</li>';
                    }
                    html=html+'</ul><div class="count fc">'+
                            '<div class="text fl">'+
                            '共计'+ data.list.length +'门课程<br>'+
                            '合计:<span class="yellow fwb">'+ data.result.totalPrice +'</span>元'+
                            '</div>'+
                            '<a class="btn btn_yellow3 fr ft14 mr5" href="/shopping/gotoCart">去购物车结算</a>'+
                            '</div>';
                    $('#lhb_cart_lt1').html(html);
                }
            }
        });
    }



    function theCartDel(a,b,c){
    //购物车列表删除
        $.ajax({
            type: "GET",
            url: "/shopping/cartCourseRemove?productIds="+ a +"_"+ b +"_"+ c,
            cache:false,
            dataType: "json",
            success: function(data){
                if(data.result.totalCount<=0){
                    $("#lhb_cart_num").hide();
                    $("#buy_list").hide();
                    $("#lhb_cart_lt1_h").show();
                }else{
                    $('#lhb_cart_lt1').empty();
                    var html = '';
                    $("#lhb_cart_num").show();
                    $("#buy_list").show();
                    $("#lhb_cart_lt1_h").hide();
                    html ="<ul>"
                    for (var i=0;i<data.list.length;i++){
                        html +='<li class="fc">'+
                                '<a class="buy_car_img fl" href="/course/'+ data.list[i].productId +'">'+
                                '<img src="'+ data.list[i].productIconUrlStr +'" onerror=\"this.src=\'http://images.koolearn.com/www/subject/kuxue/img/common/default_im.jpg\'\" width="56" height="35">'+
                                '</a>'+
                                '<h3 class="buy_car_title fl"><a href="/course/'+ data.list[i].productId +'" title="'+ data.list[i].productName +'">'+ data.list[i].productName +'</a></h3>'+
                                '<div class="buy_car_pri fr">'+
                                '<span class="yellow fwb">￥'+ data.list[i].productDiscountPrice +'</span><br>'+
                                '<a href="javascript:void(0);" onclick="theCartDel('+data.list[i].userId+','+data.list[i].productId+','+data.list[i].promotionId+')">×</a>'+
                                '</div>'+
                                '</li>';
                    }
                    html=html+'</ul><div class="count fc">'+
                            '<div class="text fl">'+
                            '共计'+ data.list.length +'门课程<br>'+
                            '合计:<span class="yellow fwb">'+ data.result.totalPrice +'</span>元'+
                            '</div>'+
                            '<a class="btn btn_yellow3 fr ft14 mr5" href="/shopping/gotoCart">去购物车结算</a>'+
                            '</div>';
                    $('#lhb_cart_lt1').html(html);
                }
                if($("#cartshopingtable").length>0){
                    location.reload(true) ;
                }
                theCartNum();
            }
        });
    }



    var regUrl = /\/head\/(toRegist|toLogin|getBackPwd)/;
    function login(){
        var userName = $('#puserName').val();
        var password = $('#ppassword').val();

        //手机号
        if(userName == '')
        {
            $('#nameError').show();
            $('#nameErrorText').text('账号不能为空');
            return;
        }
        //密码
        if(password == '')
        {
            $('#ppwdError').show();
            $('#ppwdErrorText').text('密码不能为空');
            return;
        }
        var url = "http://login.koo.cn/sso//quickLogin.do?";
        if ( url.indexOf("?") == -1 ) {
            url += "?type=jsonp";
        }
        else {
            url += "&type=jsonp";
        }
        if($("#autoLogin").is(":checked"))
            url += "&autoLogin=on";

        $.ajax({
            url:url,
            dataType:'jsonp',
            data:{"userName":userName,"password":password},
            cache:false,
            success:function(data){
                if(data == 'success'){
                    $('#_userName').val(userName);
                    $('#_password').val(password);

                    if(regUrl.test(window.location)){
                        //window.location='http://www.koo.cn';
                        $('#_next_page').val('http://www.koo.cn');
                    }
                    else{
                        //window.location.reload();
                        $('#_next_page').val(window.location);
                    }
                    $('#_userName').attr('name','userName');
                    $('#_password').attr('name','password');
                    $('#_next_page').attr('name','next_page');
                    $('#_failPage').attr('name','failPage');
                    //自动登录
                    if($("#autoLogin").is(":checked")){
                        $('#_autoLogin').attr('name','autoLogin');
                    }
                    $('#_loginForm').submit();
                }
                if(data == 'error.login.userNameIsError'){
                    $('#returnError').show();
                    //  $('#pnameErrorText').text('用户名或密码错误');
                }
                if(data == 'error.login.timeInterval'){
                    $('#pnameError').show();
                    $('#pnameErrorText').text('账号在其他地方登录');
                }
                if(data == 'error.login.kicked'){
                    $('#pnameError').show();
                    $('#pnameErrorText').text('帐号在其他地方登录');
                }
                if(data == 'error.login.threepassError'){
                    $('#pnameError').show();
                    $('#pnameErrorText').text('连续三次密码错误，请5分钟后再登录');
                }
            },
            error: function() {

            }
        });
    }
    $('#puserName').on("focus",function(){reset1(1)});
    $('#ppassword').on("focus",function(){reset1(2)});
    function reset1(p){
        if(p == 1){
            $('#nameError').hide();
            $('#pnameError').hide();
            $('#preturnError').hide();
        }
        if(p == 2){
            $('#ppwdError').hide();
        }
    }

    function popLogin(){
    //用户登录框
        dialog({
            width:"460",
            selector:"#pop_login_v2",
            callback:{
                "btn":function(){
                    $(".zmask").on("click",function(){
                        $("#pop_login_v2").hide();
                        $(".zmask").remove();
                    })
                }
            }
        })
    }

    // $(function(){
    //     //登录切换  需要引入 http://images.koolearn.com/www/subject/script/common.js
    //     //popLogin();
    //     $("#pop_login_v2").ontabs(".pop_tab li",".pop_ct   form","cur","mouseover");


    // })

    function thirdLogin(thirdType,type){
        var nextPage=$("input[name='next_page']").val();
        var kooNextPage='http://www.koo.cn/thirdLoginCon/callBack?bind='+type+'&nextPage='+nextPage;
        //var koo_next=encodeURIComponent(kooNextPage);
        var koo_next_url=base64_encode(kooNextPage);
        var url='http://login.koolearn.com/sso//requestToken.do?koo_next_page='+koo_next_url+'&type='+thirdType+'&f=www_third_denglu';
        location.href=url;
    }



    function base64_encode(str){
        var c1, c2, c3;
        var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
        var i = 0, len= str.length, string = '';

        while (i < len){
            c1 = str.charCodeAt(i++) & 0xff;
            if (i == len){
                string += base64EncodeChars.charAt(c1 >> 2);
                string += base64EncodeChars.charAt((c1 & 0x3) << 4);
                string += "==";
                break;
            }
            c2 = str.charCodeAt(i++);
            if (i == len){
                string += base64EncodeChars.charAt(c1 >> 2);
                string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
                string += base64EncodeChars.charAt((c2 & 0xF) << 2);
                string += "=";
                break;
            }
            c3 = str.charCodeAt(i++);
            string += base64EncodeChars.charAt(c1 >> 2);
            string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
            string += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
            string += base64EncodeChars.charAt(c3 & 0x3F)
        }
        return string;
    }
</script>
<import type='css' file="Css.ck_base" />
<import type='css' file="Css.ck_headmaster" />
<link rel="stylesheet" type="text/css" href="__ROOT__/Public/Css/jquery.Jcrop.min.css" media="all">
<link rel="stylesheet" type="text/css" href="__ROOT__/Public/Js/uploadify-v3.1/uploadify.css" media="all">
<script type="text/javascript" src="__ROOT__/Public/Js/uploadify-v3.1/jquery.uploadify-3.1.min.js"></script>
<script type="text/javascript" src="__ROOT__/Public/Js/jquery.Jcrop.min.js"></script>
<script type="text/javascript" src="__ROOT__/Public/Js/ThinkBox/jquery.ThinkBox.js"></script>
<link rel="stylesheet" type="text/css" href="__ROOT__/Public/Js/ThinkBox/css/ThinkBox.css" media="all">
<div class="postContent" style="width:900px">
        <!-- =S 发布页步骤 -->
        <!-- 第一步postStep_1 第二步postStep_2 第三步postStep_3 第四步postStep_4 -->
        <dl class="postStep_2" style="width:900px">
            <dt>课程管理</dt>
            <!-- <dd class="i1">选择分类</dd>
            <dd class="i2">填写课程信息</dd>
            <dd class="i3">发布成功</dd> -->
        </dl>
        <!-- =E 发布页步骤 -->
        <div class="pageContainer pt20 mb20" style="width:900px;min-width:0px">
        
<script>
//我的课程首页广播
window.KK._config.adminMenu = "seller";
//window.KK._config.broadCast = "sellerIndex";
</script>       
    <div class="pageContent" style="width:900px">
        <!-- <div class="mcTitle clearfix">
            <ul class="user_tab1 fl">
                <li class="curr"><a href="./courseList_files/courseList.htm">课程列表</a></li>
                <li><a href="http://www.chuanke.com/?mod=seller&act=course&do=typelist">分类管理</a></li>
                <li><a href="http://www.chuanke.com/?mod=seller&act=course&do=timelist">课程日历</a></li>
            </ul>
            <a class="clear_class fr mr20" href="http://www.chuanke.com/?mod=seller&act=course&do=recyclelist">回收站</a>
        </div>   -->        
        <div class="kclb_ext">
            <div class="mb30 pt10">
                <div id="search_box" class="pr fl mr10">
                    <!-- <span class="iptTips" id="ck_prompt_2">请输入课程标题</span> -->
                    <input type="text" id="course_keyword" prompt="请输入课程名" class="form_text" style="width:380px" value="" placeholder="请输入课程名或者关键字">
                </div>
                <a id="search_course" class="n_btn30gr_b" href="javascript:;"><span>搜索</span></a>
                <span class="ml20" style="display:none"><a href="http://www.chuanke.com/?mod=seller&act=exclusive&do=list">申请独家课程</a></span>
            </div>
            <div class="kclb_ext_s">
                <dl class="dl_u_zt pt20">
                    <dt class="mr10"><span class="fn">状态：</span></dt>
                    <dd> 
                        <a  href="" class="curr">全部</a>
                        <a href="http://www.chuanke.com/?mod=seller&act=course&status=2&keyword=&typeid=0">销售中</a>
                        <!-- <a href="http://www.chuanke.com/?mod=seller&act=course&status=1&keyword=&typeid=0">未发布</a>
                        <a href="http://www.chuanke.com/?mod=seller&act=course&status=4&keyword=&typeid=0">已停售</a> -->
                        <a href="http://www.chuanke.com/?mod=seller&act=course&status=3&keyword=&typeid=0">已过期</a>
                    </dd>
                </dl>
                <ul class="dl_u_xz fr">
                    <li class="fl">
                        <span>课程分类：</span>
                        <select name="parentType" id="parentType">
                            <option value="0"> - 全部分类 - </option>
                        <foreach name="categoryInfo" item="vo" >
                            <option value="{$vo['id']}"> - {$vo['categoryname']} - </option>
                        </foreach>
                        </select>
                    </li>
                    <li class="fl ml30">
                        <span>子分类：</span>
                        <select name="subType" id="subType">
                            <option value="0"> - 全部分类 - </option>
                            
                        </select>
                    </li>
                </ul>
            </div>
        </div>
        <div class="tabBox_kclb mb20">
            <table cellspacing="0" class="mcTab">
                <colgroup>
                    <col width="70">
                    <col width="360">
                    <col width="120">
                    <col width="120">
                    <col width="110">
                    <col width="100">
                    <col width="">
                </colgroup>
                <thead>
                    <tr>
                        <th><span class="pl20">编号</span></th>
                        <th><span class="pl120">课程名称</span></th>
                        <th ><span>价格</span></th>
                        <th><span>购买人数</span></th>
                        <th><span>发布时间</span></th>
                       <!--  <th><span>状态</span></th> -->
                        <th><span>操作</span></th>
                    </tr>
                </thead>
                <tbody>
                <foreach name="courseInfo" item="vo">
                    <tr>
                        <td>
                            <div class="pl20"><span class="c_555">{$vo['id']}</span></div>
                        </td>
                        <td>
                            <dl class="picTxt">
                                <dt class="pic fl"><a href="{:U('Index/Course/show',array('id'=>$vo['id']))}" target="_blank"><img width="80" height="60" src="__ROOT__{$vo['picture']}"></a></dt>
                                <dd class="txt fl ml20">
                                    <a class="c_555" href="{:U('Index/Course/show',array('id'=>$vo['id']))}" target="_blank">{$vo['coursename']}<em class="c_f60"></em></a>
                                    <div class="pt5">
                                        <span>共{$vo['lessonnum']}课时</span>
                                       <!--  <span class="mr5 ml5">|</span>
                                        <span><a href="javascript:;" class="course_content" courseid="165667">课程目录</a></span>
                                        <span class="mr5 ml5">|</span>
                                        <span><a href="javascript:;" class="editTitle edit_s" courseid="165667" title="修改标题" cname="PHP小白系列-PHP初体验">修改</a></span> -->
                                    </div>
                                </dd>
                            </dl>
                        </td>
                        <td>
                            <span>{$vo['price']}</span>
                        </td>
                        <td>
                            <if condition="$vo['applynum'] eq '' ">
                                <span>0</span>
                            <else />
                                <span>{$vo['applynum']}</span>
                            </if>
                        </td>
                        <td>
                            <div class="pr20">{$vo['createtime']|date='Y-m-d',###} <br>{$vo['createtime']|date='H:i:s',###}</div>
                        </td>
                       <!--  <td>
                            <p class="mb5"><span>销售中</span></p>
                            <p><a href="javascript:;" class="offsell" courseid="165667">停售</a></p>
                        </td> -->
                        <td>
                            <div class="edit">
                                <a class="edit_a edit_a_select1" href="javascript:;">编辑</a>
                                <ul class="edit_bd" style="display:none;z-index:998;">
                                    <li><a target="_blank" href="{:U('Index/Course/edit',array('id'=>$vo['id']))}">基本信息</a></li>
                                    <li><a target="_blank" href="{:U('Index/Course/list',array('id'=>$vo['id']))}">安排课程</a></li>
                                  <!--   <li><a target="_blank" href="http://www.chuanke.com/?mod=course&act=edit&do=courseware&courseid=165667">学习资料</a></li>
                                    <li><a target="_blank" href="http://www.chuanke.com/?mod=student&act=coursework&do=courseWorkList&sid=4013097&courseid=165667">课程作业</a></li>
                                    <li><a target="_blank" href="http://www.chuanke.com/?mod=course&act=edit&do=quizlist&courseid=165667">课程测验</a></li>
                                    <li><a target="_blank" href="http://www.chuanke.com/?mod=course&act=edit&do=appointTeacher&courseid=165667">辅导员</a></li>   -->              
                                </ul>
                            </div>
                        </td>
                    </tr>
                </foreach>
                </tbody>
            </table>
        </div>
    </div>
<s class="clearfix"></s>
<div class="page-control" style="width:300px;height:30px;margin:0 auto">
    <style>
        .first,.prev,.next,.end,.num,.current{
            display: block;
            height:30px;
            /*border: 1px solid red;*/
            float: left;
            padding: 0px 5px;
            line-height: 30px;
            min-width: 35px;
        }
        .current{
            background: #499EF3 url() 0 0 no-repeat;
            color: #fff;
        }
        .first,.prev,.next,.end,.num:hover{
            color: #2A6496;
            background-color: #EEE;
            border-color: #DDD;
        }
    </style>
    <ul class="pagination pull-right" style="text-align:center">
        {$page}
    </ul>
</div>


</div>
<script>
var Params = eval('({\"Status\":0,\"Keyword\":\"\",\"TypeID\":0})');
var TypeInfo = eval('({\"PID\":0,\"TypeID\":0})');
var TypeList = eval('({\"26205\":{\"TypeID\":\"26205\",\"SID\":\"4013097\",\"PID\":\"0\",\"Level\":\"1\",\"Name\":\"PHP\\u8bfe\\u7a0b\",\"SortID\":\"1\"},\"26206\":{\"TypeID\":\"26206\",\"SID\":\"4013097\",\"PID\":\"0\",\"Level\":\"1\",\"Name\":\"\\u5de5\\u5177\\u7c7b\",\"SortID\":\"2\"},\"26207\":{\"TypeID\":\"26207\",\"SID\":\"4013097\",\"PID\":\"0\",\"Level\":\"1\",\"Name\":\"Mysql\",\"SortID\":\"3\"},\"26208\":{\"TypeID\":\"26208\",\"SID\":\"4013097\",\"PID\":\"0\",\"Level\":\"1\",\"Name\":\"HTML+CSS\",\"SortID\":\"4\",\"SubType\":[{\"TypeID\":\"26209\",\"SID\":\"4013097\",\"PID\":\"26208\",\"Level\":\"2\",\"Name\":\"\",\"SortID\":\"1\"}]}})');
$(function(){
    $("#course_keyword").keydown(function(event){
        if(event.keyCode == 13){
            $("#search_course").trigger('click');
        }
    });
    
    //搜索课程
    $("#search_course").click(function(){
        var keyword = $.trim($("#course_keyword").val());
        var searchUrl = KK._kkurl+'/?mod=seller&act=course&status='+Params.Status+'&keyword='+encodeURIComponent(keyword)+'&typeid='+Params.TypeID;
        document.location.href = searchUrl;
        return false;
    });
    
    //初始化分类选择
    var ptype = $("#parentType");
    var stype = $("#subType");
    ptype.val(TypeInfo.PID);
    stype.val(TypeInfo.TypeID);
    
    ptype.change(function(){
        var tid = ptype.val();
        var searchUrl = KK._kkurl+'/?mod=seller&act=course&status='+Params.Status+'&keyword='+encodeURIComponent(Params.Keyword)+'&typeid='+tid;
        document.location.href = searchUrl;
        return false;
    });
    
    stype.change(function(){
        var tid = stype.val();
        var searchUrl = KK._kkurl+'/?mod=seller&act=course&status='+Params.Status+'&keyword='+encodeURIComponent(Params.Keyword)+'&typeid='+tid;
        document.location.href = searchUrl;
        return false;
    });
    
    //编辑菜单
    $('.tabBox_kclb').find('.edit').hover(function(){
        $(this).css({'position':'relative'});
        $(this).find('.edit_a').addClass('edit_a_select').next('.edit_bd').show();
    },function(){
        $(this).css({'position':''})
        $(this).find('.edit_a').removeClass('edit_a_select').next('.edit_bd').hide();
    });
});
</script>
<script src="__ROOT__/Public/Js/course_list.js"></script>
</div>
    <div style="display:none;">
<script src="__ROOT__/Public/Js/ckpv.js" language="javascript"></script>
<!-- <script type="text/javascript" src="__ROOT__/Public/Js/ThinkBox/ckpv.js"></script> -->

</div>
<script>
 // $(function(){
    // $("#expiretimeTips").inputTips();
    // $("#studentlimitTips").inputTips();
    // $("#TeacherBriefTips").inputTips();
    // var SID = 4013097,
    //  CacheParentType = "",
    //  CacheSubType = "",
    //  CourseID = false,
    //  IsAuthorize = 0,    //任命发课
    //  IsRecreate = false,     //重新发布
    //  ClassroomLimit = 200;
    //  $("#customParentType").val(0);
    // var custom_type = eval('({\"26205\":{\"TypeID\":\"26205\",\"SID\":\"4013097\",\"PID\":\"0\",\"Level\":\"1\",\"Name\":\"PHP\\u8bfe\\u7a0b\",\"SortID\":\"1\"},\"26206\":{\"TypeID\":\"26206\",\"SID\":\"4013097\",\"PID\":\"0\",\"Level\":\"1\",\"Name\":\"\\u5de5\\u5177\\u7c7b\",\"SortID\":\"2\"},\"26207\":{\"TypeID\":\"26207\",\"SID\":\"4013097\",\"PID\":\"0\",\"Level\":\"1\",\"Name\":\"Mysql\",\"SortID\":\"3\"},\"26208\":{\"TypeID\":\"26208\",\"SID\":\"4013097\",\"PID\":\"0\",\"Level\":\"1\",\"Name\":\"HTML+CSS\",\"SortID\":\"4\",\"SubType\":[{\"TypeID\":\"26209\",\"SID\":\"4013097\",\"PID\":\"26208\",\"Level\":\"2\",\"Name\":\"\",\"SortID\":\"1\"}]}})');
    //          var SchoolTrialStatus = 1;
    // })
    </script>
<script src="__ROOT__/Public/Js/plugins/My97DatePicker/WdatePicker.js"></script>
<!-- <script charset="utf-8" src="/js/editor/kindeditor-min.js"></script>
<script charset="utf-8" src="/js/editor/lang/zh_CN.js"></script>
<script src="http://res.ckimg.com/lib/jquery/plugin/jquery.uploadify-3.1.js" type="text/javascript"></script> -->

<import type='js' file="Js.post-dev" />


<div class=" koo_bg_gray pt20">
    <div class="w980 mauto">
        <div class="copy-right w980 mauto ft14">
            <ul>
                <li><a href="http://www.koo.cn/gb/aboutus/" rel="nofollow">关于我们</a></li>
                <li><a href="http://www.koo.cn/gb/join/" rel="nofollow">人员招聘</a></li>
                <li><a href="http://www.koo.cn/gb/contact/" rel="nofollow">联系我们</a></li>
                <li><a href="http://www.koo.cn/help/learn/1/" rel="nofollow">帮助中心</a></li>
                <li class="info gray w320">
                    <p>酷学网&nbsp; 收获每一课 京ICP备05067669号-4</p>
                    <p>北京新东方教育科技（<span title="14-wwwb">集团</span>）有限公司 版权所有</p>
                </li>
            </ul>
        </div>
    </div>
    <!--[if IE]>
    <script type="text/javascript" src="http://images.koolearn.com/www/subject/kuxue/js/jquery.placeholder.js"></script>

    <![endif]-->
    <!--[if lt IE 7]>
    <script type="text/javascript" src="http://images.koolearn.com/www/subject/script/json2.min.js"></script>

    <![endif]-->

    <!-- Baidu Button BEGIN -->
    <!--<script src="customer_files/bds_s_v2.js" type="text/javascript" id="bdshare_js" data="type=slide&amp;img=0&amp;pos=right&amp;uid=324170"></script>-->
    <!--<import type='js' file="Js.bds_s_v2" />-->

    <script type="text/javascript">
    //     $(function(){
    //         var bds_config = {"bdTop":283,'snsKey':{'tsina':'3297384058','tqq':'ba36faf481494730bccc2c58de9f6cf9'}};
    //         $("#bdshell_js").attr("src","http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000));
    //     })
   </script>
    <!-- Baidu Button END -->


    <script src="__ROOT__/Public/Js/koolearnCollection.js" id="__sprout_main__" conf="http://images.koolearn.com/www/subject/script/kuxueConf.js"></script>
    <import type='js' file="Js.kuxue-tongji" />

    <import type='js' file="Js.cookie" />

   <script>
    //     $(function(){
    //         $('.zb_lst2 li:nth-child(3n)').css('margin-right','0');
    //         hrefIdCookie(["a_id","kid"]);
    //     })
 </script>



</div>


<div id="koo-go-top" class="">
    <a href="http://weibo.com/koocn" class="weibo"></a>
    <a href="javascript:void(0);" class="weixin pos_r"><img src="__ROOT__/Public/Images/towcode.png" alt="" height="220" width="231"></a>
    <a href="http://bbs.koo.cn/f-86-1.html" class="message"></a>
    <a href="http://www.koo.cn/app" class="telphone"></a>
    <a href="javascript:void(0);" target="_blank" onclick="doyoo.util.openChat('g=10055922&amp;command=robotChat'); return false;" class="aq"></a>
    <a href="javascript:void(0);" onclick="return false" class="to-top  cursor" style="display: none;"></a>
</div>
<div style="position: fixed; top: 120px; right: 5px; color: rgb(0, 0, 0); font-size: 12px;" id="doyoo_panel">

</div>
<!-- <div style="background: transparent url(&quot;http://static.soperson.com/131221/../default/images/monitor/m_bg_1.gif?131127&quot;) no-repeat scroll 0% 0%; width: 429px; height: 196px; position: fixed;" id="doyoo_monitor">
    <div id="doyoo_mon_innner" style="position:relative;width:100%;height:100%;-webkit-transform: translateZ(0px)">
        <div style="cursor: move;" id="doyoo_mon_head">在线客服</div>
        <div id="doyoo_mon_main">同学您好，目前新旧系统交替，可能无法及时回复您的对话，如有问题可拨打4006762300按2咨询，给您造成的不便，请谅解！</div>
        <div id="doyoo_mon_foot">
            <a style="background-image: url(&quot;http://static.soperson.com/131221/../default/images/monitor/acc_sc.gif?131127&quot;);" id="doyoo_mon_accept" class="doyoo_mon_btn" href="javascript:;" onclick="doyoo.util.openChat();doyoo.util.accept();return false;"></a>
            <a style="background-image: url(&quot;http://static.soperson.com/131221/../default/images/monitor/phone_sc.gif?131127&quot;); display: none;" id="doyoo_mon_phone" class="doyoo_mon_btn" href="javascript:;" onclick="doyoo.util.openPhone();doyoo.util.accept();return false;"></a>
            <div style="background-image: url(&quot;http://static.soperson.com/131221/../default/images/monitor/dn_sc.gif?131127&quot;);" id="doyoo_mon_refuse" class="doyoo_mon_btn">

            </div>
        </div>
    </div>
    <div id="doyoo_mon_closer">

    </div>
</div> -->
<!-- <div id="doyoo_share" style="">

    <iframe src="about:blank" id="shareWrapper"></iframe>
</div> -->

<img id="uuidimg" src="__ROOT__/Public/Images/__ktm.gif">


</body>
</html>
<script type="text/javascript">
    $(function(){
        //上传头像(uploadify插件)
        $("#user-pic").uploadify({
            'queueSizeLimit' : 1,
            'removeTimeout' : 0.5,
            'preventCaching' : true,
            'multi'    : false,
            'swf'           : '__ROOT__/Public/Js/uploadify-v3.1/uploadify.swf',
            'uploader'      : "{:U('Index/Course/uploadImg')}",
            'buttonText'    : '<i class="userup-icon"></i>上传头像',
            'width'         : '200',
            'height'        : '200',
            'fileTypeExts'  : '*.jpg; *.png; *.gif;',
            'formData' :    { 'uid' : '{$Think.session.uid}' },
            'onUploadSuccess' : function(file, data, response){
                //调试语句
                $('#isteacher').val(1);
                
                console.log(data);

                
                var data = $.parseJSON(data);
                
                if(data['status'] == 0){
                    $.ThinkBox.error(data['info'],{'delayClose':3000});
                    return;
                }
                var preview = $('.upload-area').children('#preview-hidden');
                preview.show().removeClass('hidden');
                //两个预览窗口赋值
                $('.crop').children('img').attr('src',data['path']+'?random='+Math.random());
                //隐藏表单赋值
                $('#img_src').val(data['path']);
                //绑定需要裁剪的图片
                var img = $('<img />');
                preview.append(img);
                preview.children('img').attr('src',data['path']+'?random='+Math.random());
                var crop_img = preview.children('img');
                crop_img.attr('id',"cropbox").show();
                var img = new Image();
                img.src = data['path']+'?random='+Math.random();
                //根据图片大小在画布里居中
                img.onload = function(){
                    var img_height = 0;
                    var img_width = 0;
                    var real_height = img.height;
                    var real_width = img.width;
                    if(real_height > real_width && real_height > 200){
                        var persent = real_height / 200;
                        real_height = 200;
                        real_width = real_width / persent;
                    }else if(real_width > real_height && real_width > 200){
                        var persent = real_width / 200;
                        real_width = 200;
                        real_height = real_height / persent;
                    }
                    if(real_height < 200){
                        img_height = (200 - real_height)/2;
                    }
                    if(real_width < 200){
                        img_width = (200 - real_width)/2;
                    }
                    preview.css({width:(200-img_width)+'px',height:(200-img_height)+'px'});
                    preview.css({paddingTop:img_height+'px',paddingLeft:img_width+'px'});
                }
                //裁剪插件
                $('#cropbox').Jcrop({
                    bgColor:'#333',   //选区背景色
                    bgFade:true,      //选区背景渐显
                    fadeTime:1000,    //背景渐显时间
                    allowSelect:false, //是否可以选区，
                    allowResize:true, //是否可以调整选区大小
                    aspectRatio: 1,     //约束比例
                    minSize : [100,100],//可选最小大小
                    boxWidth : 200,     //画布宽度
                    boxHeight : 200,    //画布高度
                    onChange: showPreview,//改变时重置预览图
                    onSelect: showPreview,//选择时重置预览图
                    setSelect:[ 0, 0, 100, 100],//初始化时位置
                    onSelect: function (c){ //选择时动态赋值，该值是最终传给程序的参数！
                        $('#x').val(c.x);//需裁剪的左上角X轴坐标
                        $('#y').val(c.y);//需裁剪的左上角Y轴坐标
                        $('#w').val(c.w);//需裁剪的宽度
                        $('#h').val(c.h);//需裁剪的高度
                  }
                });
                //提交裁剪好的图片
                $('.save-pic').click(function(){
                    if($('#preview-hidden').html() == ''){
                        $.ThinkBox.error('请先上传图片！');
                    }else{
                        //由于GD库裁剪gif图片很慢，所以长时间显示弹出框
                        $.ThinkBox.success('图片处理中，请稍候……',{'delayClose':30000});
                        $('#pic').submit()
                    }
                });
                //重新上传,清空裁剪参数
                var i = 0;
                $('.reupload-img').click(function(){
                    $('#preview-hidden').find('*').remove();
                    $('#preview-hidden').hide().addClass('hidden').css({'padding-top':0,'padding-left':0});
                });
            }
        });
        //预览图
        function showPreview(coords){
            var img_width = $('#cropbox').width();
            var img_height = $('#cropbox').height();
              //根据包裹的容器宽高,设置被除数
            var rx = 100 / coords.w;
            var ry = 100 / coords.h;
              $('#crop-preview-100').css({
                width: Math.round(rx * img_width) + 'px',
                height: Math.round(ry * img_height) + 'px',
                marginLeft: '-' + Math.round(rx * coords.x) + 'px',
                marginTop: '-' + Math.round(ry * coords.y) + 'px'
              });
              rx = 60 / coords.w;
              ry = 60 / coords.h;
              $('#crop-preview-60').css({
                width: Math.round(rx * img_width) + 'px',
                height: Math.round(ry * img_height) + 'px',
                marginLeft: '-' + Math.round(rx * coords.x) + 'px',
                marginTop: '-' + Math.round(ry * coords.y) + 'px'
              });
        }
    })

</script>


<script type="text/javascript">
    $(function(){
        //上传封面(uploadify插件)
        $("#user-pic1").uploadify({
            'queueSizeLimit' : 1,
            'removeTimeout' : 0.5,
            'preventCaching' : true,
            'multi'    : false,
            'swf'           : '__ROOT__/Public/Js/uploadify-v3.1/uploadify.swf',
            'uploader'      : "{:U('Index/Course/uploadImgCourse')}",
            'buttonText'    : '<i class="userup-icon1"></i>上传封面',
            'width'         : '315',
            'height'        : '200',
            'fileTypeExts'  : '*.jpg; *.png; *.gif;',
            'formData' :    { 'uid' : '{$Think.session.uid}' },
            'onUploadSuccess' : function(file, data, response){
                //调试语句
               $('#ispicture').val(1);
                console.log(data);
                
                var data = $.parseJSON(data);
                
                if(data['status'] == 0){
                    $.ThinkBox.error(data['info'],{'delayClose':3000});
                    return;
                }
                var preview = $('.upload-area1').children('#preview-hidden1');
                preview.show().removeClass('hidden1');
                //两个预览窗口赋值
                $('.crop1').children('img').attr('src',data['path']+'?random='+Math.random());
                //隐藏表单赋值
                $('#img_src1').val(data['path']);
                //绑定需要裁剪的图片
                var img = $('<img />');
                preview.append(img);
                preview.children('img').attr('src',data['path']+'?random='+Math.random());
                var crop_img = preview.children('img');
                crop_img.attr('id',"cropbox1").show();
                var img = new Image();
                img.src = data['path']+'?random='+Math.random();
                //根据图片大小在画布里居中
                img.onload = function(){
                    var img_height = 0;
                    var img_width = 0;
                    var real_height = img.height;
                    var real_width = img.width;
                    if(real_height > real_width && real_height > 200){
                        var persent = real_height / 200;
                        real_height = 200;
                        real_width = real_width / persent;
                    }else if(real_width > real_height && real_width > 315){
                        var persent = real_width / 315;
                        real_width = 315;
                        real_height = real_height / persent;
                    }
                    if(real_height < 200){
                        img_height = (200 - real_height)/2;
                    }
                    if(real_width < 315){
                        img_width = (315 - real_width)/2;
                    }
                    preview.css({width:(315-img_width)+'px',height:(200-img_height)+'px'});
                    preview.css({paddingTop:img_height+'px',paddingLeft:img_width+'px'});
                }
                //裁剪插件
                $('#cropbox1').Jcrop({
                    bgColor:'#333',   //选区背景色
                    bgFade:true,      //选区背景渐显
                    fadeTime:1000,    //背景渐显时间
                    allowSelect:false, //是否可以选区，
                    allowResize:true, //是否可以调整选区大小
                    aspectRatio: 1.57,     //约束比例
                    minSize : [145,92],//可选最小大小
                    boxWidth : 400,     //画布宽度
                    boxHeight : 200,    //画布高度
                    onChange: showPreview,//改变时重置ss预览图
                    onSelect: showPreview,//选择时重置预览图
                    setSelect:[ 0, 0, 145, 92],//初始化时位置
                    onSelect: function (c){ //选择时动态赋值，该值是最终传给程序的参数！
                        $('#x1').val(c.x);//需裁剪的左上角X轴坐标
                        $('#y1').val(c.y);//需裁剪的左上角Y轴坐标
                        $('#w1').val(c.w);//需裁剪的宽度
                        $('#h1').val(c.h);//需裁剪的高度
                  }
                });
                //提交裁剪好的图片
                $('.save-pic1').click(function(){
                    if($('#preview-hidden1').html() == ''){
                        $.ThinkBox.error('请先上传图片！');
                    }else{
                        //由于GD库裁剪gif图片很慢，所以长时间显示弹出框
                        $.ThinkBox.success('图片处理中，请稍候……',{'delayClose':30000});
                        $('#pic1').submit()
                    }
                });
                //重新上传,清空裁剪参数
                var i = 0;
                $('.reupload-img1').click(function(){
                    $('#preview-hidden1').find('*').remove();
                    $('#preview-hidden1').hide().addClass('hidden1').css({'padding-top':0,'padding-left':0});
                });
            }
        });
        //预览图
        function showPreview(coords){
            var img_width = $('#cropbox1').width();
            var img_height = $('#cropbox1').height();
              //根据包裹的容器宽高,设置被除数
            var rx = 146 / coords.w;
            var ry = 92 / coords.h;
              $('#crop-preview-1001').css({
                width: Math.round(rx * img_width) + 'px',
                height: Math.round(ry * img_height) + 'px',
                marginLeft: '-' + Math.round(rx * coords.x) + 'px',
                marginTop: '-' + Math.round(ry * coords.y) + 'px'
              });
              rx = 60 / coords.w;
              ry = 60 / coords.h;
              $('#crop-preview-601').css({
                width: Math.round(rx * img_width) + 'px',
                height: Math.round(ry * img_height) + 'px',
                marginLeft: '-' + Math.round(rx * coords.x) + 'px',
                marginTop: '-' + Math.round(ry * coords.y) + 'px'
              });
        }
    })

</script>
